Socket
Socket
Sign inDemoInstall

it-all

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-all


Version published
Maintainers
1
Install size
3.64 kB
Created

Package description

What is it-all?

The 'it-all' npm package is a utility that collects all items from an async iterable into an array. It is particularly useful when working with streams or other asynchronous data sources where you need to gather all the data into a single array for further processing.

What are it-all's main functionalities?

Collecting async iterable into an array

This feature allows you to collect all items from an async iterable into an array. The code sample demonstrates how to use 'it-all' to gather values from an async generator function into a single array.

const itAll = require('it-all');

async function example() {
  const asyncIterable = async function* () {
    yield 1;
    yield 2;
    yield 3;
  };

  const result = await itAll(asyncIterable());
  console.log(result); // [1, 2, 3]
}

example();

Other packages similar to it-all

Readme

Source

it-all

Build status Coverage Status Dependencies Status

Collects all values from an (async) iterable into an array and returns it.

For when you need a one-liner to collect iterable values.

Install

$ npm install --save it-all

Usage

const all = require('it-all')

// This can also be an iterator, async iterator, generator, etc
const values = [0, 1, 2, 3, 4]

const arr = await all(values)

console.info(arr) // 0, 1, 2, 3, 4

FAQs

Last updated on 10 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc